package com.example.train.batch.config;

import com.example.train.common.interceptor.LogInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 写法比较固定，用于在相应模块启动拦截器
 * 现在开启了日志拦截器和会员信息拦截器
 * 这里开启的是跑批拦截器
 */
@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {


    @Resource
    LogInterceptor logInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(logInterceptor)
                .addPathPatterns("/**");
    }
}
